Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse working_dir switch #195

Merged
merged 24 commits into from
May 10, 2024
Merged

Parse working_dir switch #195

merged 24 commits into from
May 10, 2024

Conversation

nappex
Copy link
Collaborator

@nappex nappex commented Oct 15, 2023

fix #182

lib/cli.ex Outdated

parsed_switches
|> Keyword.get(:working_dir, File.cwd!())
|> module.main
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Elixir style guide suggests using parentheses in the pipe operator.

Use parentheses for one-arity functions when using the pipe operator (|>).

Suggested change
|> module.main
|> module.main()

I’d generally incline towards using them for functions without an argument, mainly for consistency. The Guide considers that preferred, although in other examples they use them without parens a lot themselves.

Use parentheses in function calls, especially inside a pipeline.

   --working-dir is switch which allow user use different
   working directory than only current working directory
@Glutexo Glutexo force-pushed the parse-working-dir branch from 81546fb to 8f80dca Compare March 16, 2024 14:27
@Glutexo Glutexo force-pushed the parse-working-dir branch from 8f80dca to 4e5fa37 Compare March 16, 2024 14:28
@nappex
Copy link
Collaborator Author

nappex commented Mar 16, 2024

DONT FORGET TO TESTS!! ⚠️

@Glutexo
Copy link
Owner

Glutexo commented Mar 16, 2024

Test lowercase -c too.

Copy link
Owner

@Glutexo Glutexo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm! ❤️ Now it’s time to write tests. 💪🏻

@nappex nappex marked this pull request as ready for review April 6, 2024 20:26
@nappex
Copy link
Collaborator Author

nappex commented Apr 7, 2024

Reade for review I've already merged #223 to this PR!

lib/cli.ex Show resolved Hide resolved
lib/cli.ex Show resolved Hide resolved
lib/cli.ex Outdated Show resolved Hide resolved
lib/cli.ex Outdated Show resolved Hide resolved
@Glutexo Glutexo linked an issue Apr 20, 2024 that may be closed by this pull request
test/onigumo_cli_test.exs Show resolved Hide resolved
lib/cli.ex Show resolved Hide resolved
test/onigumo_cli_test.exs Show resolved Hide resolved
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Show resolved Hide resolved
lib/cli.ex Show resolved Hide resolved
lib/cli.ex Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Show resolved Hide resolved
@nappex nappex force-pushed the parse-working-dir branch from 95303f2 to 47e06ed Compare April 20, 2024 14:37
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
@Glutexo Glutexo self-requested a review April 23, 2024 13:31
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
@Glutexo
Copy link
Owner

Glutexo commented Apr 25, 2024

Just discovered a Mix.Shell module that has a cmd function with a :cd argument. I am not sure yet what’s that good for, but it looks related.

Update: I took a look and Mix.Shell.cmd/3 can be used to make Mix run a shell command. :cd makes it set a working directory first.

test/onigumo_cli_test.exs Outdated Show resolved Hide resolved
Copy link
Owner

@Glutexo Glutexo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Thank you for the changes! ❤️

@Glutexo Glutexo merged commit 0d890b9 into Glutexo:master May 10, 2024
1 check passed
@Glutexo Glutexo deleted the parse-working-dir branch May 10, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename root_path to working_dir Specify root path (--working-dir) by CLI argument
2 participants